package dao

import javax.inject.Inject

import models.Tables._
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import slick.jdbc.JdbcProfile

import scala.concurrent.Future

class chinaDao @Inject()(protected val dbConfigProvider: DatabaseConfigProvider) extends
  HasDatabaseConfigProvider[JdbcProfile]{


  import profile.api._


  def getAll : Future[Seq[ChinaRow]]  ={
    db.run(China.result)
  }

  def getBySheng(sheng:String) : Future[Seq[ChinaRow]] ={
    db.run(China.filter(_.sheng === sheng).result)
  }

  def getByShi(shi:String) : Future[Seq[ChinaRow]] ={
    db.run(China.filter(_.shi === shi).result)
  }

  def getByXian(xian:String) : Future[Seq[ChinaRow]] ={
    db.run(China.filter(_.xian === xian).result)
  }

}
